%% -*- mode: erlang -*-

%% Adapted version of apps/zotonic_launcher/priv/config/erlang.config.in
%% - Paths are set to /opt/zotonic/priv/...

[

 {exometer_core, [{predefined, [
    {[erlang, memory], {function, erlang, memory, [], value, []}, []},
    {[erlang, system_info], {function, erlang, system_info, ['$dp'], value, [process_count]}, []},
    {[erlang, statistics], {function, erlang, statistics, ['$dp'], value, [run_queue]}, []},
    {[erlang, io], {function, erlang, statistics, [io], match, {{'_', input}, {'_', output}}}, []}
   ]}
 ]},

 {mnesia, [
    {dir, "/opt/zotonic/priv/mnesia"}
 ]},

 {lager, [
    {handlers, [
      {lager_console_backend, [
        {level, info},
        {formatter, lager_default_formatter},
        {formatter_config, [time, color, " [", severity, "] ", {site, [site, " "], ""}, {module, [module, ":", line, " "], ""}, message, "\n"]}
      ]},
      {lager_file_backend, [
        {file, "/opt/zotonic/priv/log/error.log"},
        {level, error},
        {formatter, lager_default_formatter},
        {formatter_config, [date, " ", time, " [", severity, "] ", {site, [site, " "], ""}, {pid, ""}, {module, [{pid, ["@"], ""}, module, {function, [":", function], ""}, {line, [":", line], ""}], ""}, " ", message, "\n"] }
      ]},
      {lager_file_backend, [
        {file, "/opt/zotonic/priv/log/console.log"},
        {level, info},
        {formatter, lager_default_formatter},
        {formatter_config, [date, " ", time, " [", severity, "] ", {site, [site, " "], ""}, {pid, ""}, {module, [{pid, ["@"], ""}, module, {function, [":", function], ""}, {line, [":", line], ""}], ""}, " ", message, "\n"] }
      ]}
    ]},
    {crash_log, "/opt/zotonic/priv/log/crash.log"}
  ]},

 {ssl, [
   %%% The number of maximum number of ssl sessions cached by the server. Increase if you
   %%% of a lot of incoming connections.
   {session_cache_server_max, 20000},

   %%% The maximum time the client side information is stored in the cache (in seconds)
   {session_lifetime, 300}
 ]},

 {filezcache, [
     {data_dir, "/opt/zotonic/priv/filezcache/data"},
     {journal_dir, "/opt/zotonic/priv/filezcache/journal"}
 ]},

 {setup, [
   {data_dir, "/opt/zotonic/priv/data"},
   {log_dir,  "/opt/zotonic/priv/log"}
 ]}

].
